<script setup="">
import {ref} from 'vue'
import {menuListService} from "@/api/limit.js";

const menuList = ref([])
const getInit = async () => {
  menuList.value = await menuListService()
}
getInit()
</script>
<template>
  <el-container>
    <el-header>
      <h2>
        电商管理平台
      </h2>
    </el-header>
    <div class="main">
      <el-aside>
        <el-menu
            active-text-color="#409eff"
            background-color="#fff"
            :default-active="$route.path"
            text-color="#000"
            router
        >
          <el-sub-menu v-for="(item,index) in menuList" :key="index" :index="index">
            <template #title>
              <i class="el-icon-menu"></i>
              {{ item.authName }}
            </template>
            <el-menu-item v-for="(item1,index1) in item.children" :key="index1" :index="'/'+ item1.path">
              {{ item1.authName }}
            </el-menu-item>
          </el-sub-menu>
        </el-menu>
      </el-aside>
      <el-main>
        <router-view></router-view>
      </el-main>
    </div>
  </el-container>
</template>

<style lang="scss" scoped>
.el-container {
  height: 100vh;

  .el-header {
    border-bottom:2px solid #cce2ff;
    color: #333;
    line-height: 60px;
    height: 60px;
  }

  .main {
    height: calc(100% - 60px);
    display: flex;
    justify-content: space-between;

    .el-aside {
      height: 100%;
      width: 15%;
    }

    .el-main {
      width: 85%;
    }
  }

}
</style>
